package models

type Card struct {
	ID           int `gorm:"primary_key"json:"id"`
	UserId       int `json:"user_id"`
}


func (m *Card) TableName() string {
	return "cards"
}

func (c *Card) Get() (*Card, error) {
	var card Card

	err := DB.Model(c).Select("id").Where("user_id = ?", c.UserId).Find(&card).Error
	if err != nil {
		return nil, err
	}
	return &card, nil
}
